#include <generik/tracing.h>
GENERIK_TRACER_GLOBAL;

#include <generik/socket.h>

int main()
{
	GENERIK_TRACER;
	
	generik::socket::server s(4756);
	bool running = true;
	while (running)
	{
		generik::socket::connection* c = s.accept();
		GENERIK_TRACE("opening connection");
		
		char data[1024];
		int result = 1;
		while (result != 0)
		{
			result = c->recv(data, 1024);
			std::string msg(data, result);
			GENERIK_TRACE("found msg: "<<msg);
			result = c->send(msg);
		}
		GENERIK_TRACE("closed connection");
	}
	GENERIK_TRACE("finished");
	
	return 0;
}
